<template>
	<view class="content">
		<view class="head-title">
			<text class="title">{{title}}</text>
			<view class="title-sow">
				易货劵余额
			</view>
			<view class="tilte-soe">￥{{balance.money}}</view>
				<!-- <button type="primary" class="no-border" @click="encourage">变现</button> -->
		</view>
		<!-- 提现记录 -->
		<view class="tou">
			<view class="row" v-for="(row,index) in couponValidList" :key="index">
				<view class="one">
					<view class="title">
						{{row.title}}
					</view>
					<view class="term">
						<!-- 视图中将时间戳转为时间 -->
						{{row.updatetime}}
						<!-- {{
						new Date(parseInt(row.updatetime) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ')
						}} -->
					</view>
				</view>
				<view class="jifen">
					<view style="float: left;"><view v-if="row.type==1">+</view><view v-else>-</view></view><view style="float: left;">{{row.money}}</view>
				</view>
		
			</view>
		</view>
		
	</view>
</template>
<script>
	export default {
		data() {
			return {
				title: '余额',
				balance:'',
				couponValidList:'',
				arr:[],
			}
		},
		onShow() {
			this.ye()
		},
		onLoad() {
			this.tx()
			this.ye()
		},
		methods: {
			onPullDownRefresh: function() {
				this.tx()
				this.ye()
			},
			ye(){
				uni.request({
					url:'http://tuiguang.yiyunoto.com/api/member/mem_money',
					header:{authtoken:this.$store.state.token},
					method:'POST',
					success:(res)=>{
						console.log("请求成功",res)
						this.balance=res.data.data.memassets
						uni.stopPullDownRefresh();
					},
					fail:(res)=>{
						console.log("请求失败",res)
					}
				})
			},
			tx(){
				uni.request({
					url:'http://tuiguang.yiyunoto.com/api/member/mem_tixianInfo',
					header:{authtoken:this.$store.state.token},
					method:'POST',
					success:(res)=>{
						console.log("提现请求成功",res)
						this.couponValidList=res.data.data
						 uni.stopPullDownRefresh();
					},
					fail:(res)=>{
						console.log("请求失败",res)
					}
				})
			},
			 encourage(e) {
			        console.log(e)
			       	uni.navigateTo({
			       		url:"../Cash_in/Cash_in"
			       	})
			    },
			
			
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 100%;
	}
	
.head-title{
	width: 100%;
	height: 470upx;
	padding-top: 50upx;
	background: #42a8ff;
}
	.title {
		display: flex;
		justify-content: center;
		font-size: 36upx;
		padding-top: 30upx;
		color: #FFFFFF;
	}
	.title-sow{
		font-size: 40upx;
		position: absolute;
		left: 40upx;
		top:240upx ;
		color: #FFFFFF;
	}
	.tilte-soe{
     position: absolute;
	 left:40upx ;
     top:320upx ;
	 color: #FFFFFF;
	 font-size: 80upx;
	}
	.no-border{
		width:160upx ;
		border-radius:20upx ;
		background: #8bcaff;
		margin-left: 530upx;
		margin-top:300upx ;
		line-height: 80upx;
        text-align: center;
	}
	/* 循环列表 */
	.tou {
		width: 100%;
		height: 0upx;
	}
	.one {
		float: left;
	}
	.row {
		width: 100%;
		height: 120upx;
		background: #FFFFFF;
		margin-top: 2upx;
		border-bottom-width: 1upx;
		border-bottom-style: solid;
		border-bottom-color:#EDEDED;
	}
	.title {
		font-size: 32upx;
		font-family: PingFangSC-Regular, PingFangSC;
		color: rgba(41, 41, 41, 1);
		padding-left: 30upx;
		padding-top: 30upx;
	}
	.term {
		font-size: 26upx;
		font-family: PingFangSC-Regular, PingFangSC;
		color: rgba(127, 127, 127, 1);
		padding-left: 30upx;
		padding-top: 1upx;
	}
	.jifen {
		font-size: 41upx;
		font-family: PingFangSC-Regular, PingFangSC;
		color: rgba(51, 51, 51, 1);
		padding-left: 510upx;
		padding-top: 43upx;
	}
</style>
